package chapter7;

import java.util.Arrays;
import java.util.Random;

/**
 * Random类生成随机数
 */
public class RandomTest {
    public static void main(String[] args) {
        Random random = new Random();
        System.out.println("random.nextBoolean():" + random.nextBoolean());
        byte[] buffer = new byte[16];
        random.nextBytes(buffer);
        System.out.println(Arrays.toString(buffer));
        System.out.println("random.nextDouble():" + random.nextDouble());
        System.out.println("random.nextFloat():" + random.nextFloat());
        System.out.println("random.nextInt():" + random.nextInt());
        System.out.println("random.nextInt(26):" + random.nextInt(26));
        System.out.println("random.nextLong():" + random.nextLong());
    }
}
